/**
 * 
 */
package com.fly.sms.adapter;

import java.util.List;
import java.util.Map;

import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.fly.sms.CommonActivity;
import com.fly.sms.R;

public class SmsSendLogListAdapter extends IAdapter {
	private List<Map<String, Object>> list=null;
	TextView Name;
	TextView CreateTime;
	TextView DestNumberTotal;
	TextView SplitTotal;
	TextView SubmitNumberTotal;
	TextView SubmitSplitTotal;
	TextView SMTaskId;
	TextView smssendlogdetail;

	public SmsSendLogListAdapter(CommonActivity context,List<Map<String, Object>> list) {
		super(context);
		this.list=list;
	}

	public int getCount() {
		return  list.size();
	}

	public Object getItem(int position) {
		return position;
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView==null){
			convertView=context.getView(R.layout.smssendloglistitem);
			Name=(TextView)convertView.findViewById(R.id.Name);
			CreateTime=(TextView)convertView.findViewById(R.id.CreateTime);
			DestNumberTotal=(TextView)convertView.findViewById(R.id.DestNumberTotal);
			SplitTotal=(TextView)convertView.findViewById(R.id.SplitTotal);
			SubmitNumberTotal=(TextView)convertView.findViewById(R.id.SubmitNumberTotal);
			SubmitSplitTotal=(TextView)convertView.findViewById(R.id.SubmitSplitTotal);
			SMTaskId=(TextView)convertView.findViewById(R.id.SMTaskId);
			smssendlogdetail=(TextView)convertView.findViewById(R.id.smssendlogdetail);
		}
		Map<String, Object> map=list.get(position);
		Name.setText(map.get("Name").toString());
		CreateTime.setText(map.get("CreateTime").toString());
		DestNumberTotal.setText(map.get("DestNumberTotal").toString());
		SplitTotal.setText(map.get("SplitTotal").toString());
		SubmitNumberTotal.setText(map.get("DestNumberTotal").toString());
		SubmitSplitTotal.setText(map.get("SplitTotal").toString());
		SMTaskId.setText(map.get("SMTaskId").toString());
		smssendlogdetail.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				context.showMsg(context.getText(R.string.developing));
			}
		});
		return convertView;
	}
}
